package com.gombe.credit.app.ui.dialog

import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import com.gombe.credit.app.R
import com.gombe.credit.app.common.CommonDialog
import com.gombe.credit.app.databinding.DialogGombeCreditSubmitSuccessBinding

/**
 * GombeCredit
 * @Author wwdeng
 * @CreateTime: 2024/11/11 15:41
 * @Annotation：提交成功提示dialog（OCR、Selfie、手机号校验）
 */
class DialogGombeCreditSubmitSuccess: CommonDialog {
    private lateinit var binding: DialogGombeCreditSubmitSuccessBinding
    private var mCallback: IDialogCallback? = null
    //事件备注
    private var eventRemark = ""

    override fun initGombeCreditWindow() {
        val params = window?.attributes
        params?.width = WindowManager.LayoutParams.WRAP_CONTENT
        params?.height = WindowManager.LayoutParams.WRAP_CONTENT
        window?.attributes = params
        window?.setWindowAnimations(R.style.dialog_scale_anim) //修改动画样式
        window?.setGravity(Gravity.CENTER)
    }

    constructor(context: Context) : super(context) {}

    constructor(context: Context, callback: IDialogCallback?) : super(context) {
        mCallback = callback
    }

    constructor(context: Context, remark: String, callback: IDialogCallback?) : super(context) {
        mCallback = callback
        eventRemark = remark
    }

    /**
     * 设置点击回调
     */
    fun setOnClick(callback: IDialogCallback){
        this.mCallback = callback
    }

    override fun takeGombeCreditRootView(): View {
        binding = DialogGombeCreditSubmitSuccessBinding.inflate(LayoutInflater.from(context))
        return binding.root
    }

    override fun initGombeCreditView() {
    }

    override fun initGombeCreditListener() {
    }

    override fun takeGombeCreditData() {
    }

    override fun onGombeCreditViewClick(v: View?) {
        dismiss()
    }

    /**
     * 设置埋点备注
     */
    fun setTipsEventRemark(remark: String){
        eventRemark = remark
    }

    /**
     * 设置提示文案
     */
    fun setTipsSuccessText(tips: String){
        binding.textTips.text = tips
    }

    interface IDialogCallback {
        //按钮点击
        fun onClick(view: View?)
    }
}